#!/bin/sh

[ -n "$broadcast" ] && BROADCAST="broadcast $broadcast"
[ -n "$subnet" ] && NETMASK="netmask $subnet"
case $1 in
        bound|renew)
                ifconfig $interface $ip $BROADCAST $NETMASK
                if [ -n "$router" ] ; then
                        while route del default gw 0.0.0.0 dev $interface 2>/dev/null; do
                                :
                        done
                        metric=0
                        for i in $router ; do
                                metric=$(($metric+1))
                                route add default gw $i dev $interface metric $metric
                        done
                fi
                ;;
        deconfig)
                ifconfig $interface 0.0.0.0
                ;;
esac

exit 0
